package com.app.teaware.user;

import android.os.Bundle;
import android.os.Handler;
import android.text.TextUtils;
import android.widget.LinearLayout;

import com.app.teaware.R;
import com.app.teaware.basis.BasisActivity;
import com.app.teaware.basis.Constants;
import com.app.teaware.bean.BillListBean;
import com.app.teaware.bean.UserListBean;
import com.app.teaware.carstack.TestStackAdapter;
import com.loopeer.cardstack.CardStackView;
import com.loopeer.cardstack.UpDownStackAnimatorAdapter;

import java.util.Arrays;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import my.http.MyHttpListener;
import my.http.MyHttpUtils;
import my.http.MyParams;

/**
 * 账套信息
 */
public class UserSelectActivity extends BasisActivity implements CardStackView.ItemExpendListener{

    @BindView(R.id.stackview_main)
     CardStackView mStackView;

     TestStackAdapter mTestStackAdapter;

    @Override
    public void initViews() {
        setContentView(R.layout.activity_user_select);
        setTitle("账套信息");
    }

    @Override
    public void initData(Bundle savedInstanceState) {
        super.initData(savedInstanceState);
        mStackView.setItemExpendListener(this);
        mTestStackAdapter = new TestStackAdapter(this);
        mStackView.setAdapter(mTestStackAdapter);
        mStackView.setAnimatorAdapter(new UpDownStackAnimatorAdapter(mStackView));
        getList();

    }


    @Override
    public void onItemExpend(boolean expend) {

    }

    UserListBean mListBean;
    private void getList(){
        showLoading();
        MyParams params = new MyParams();
        MyHttpUtils.get(Constants.URL_ACCOUNT_SELECT_ALL, params, new MyHttpListener() {
                    @Override
                    public void onSuccess(int httpWhat, Object result) {
                        if (isFinishing()) return;
                        mListBean = (UserListBean) result;
                        mTestStackAdapter.updateData(mListBean.getList());
                    }

                    @Override
                    public void onFailure(int httpWhat, Object result) {
                        super.onFailure(httpWhat, result);
                        dismissProgress();
                    }

                    @Override
                    public void onFinish(int httpWhat) {
                        dismissProgress();
                    }
                },
                0, UserListBean.class);
    }
}
